<?php $show_validate = true;  include THEMES_PATH.'public/before_body2.phtml';?>
</head>
<body>
<?php include THEMES_PATH.'public/header2.phtml';?>
<div class="clearfix main-width mt5x mb5x">
  <form action="<?php echo url('order/query');?>" method="post" target="_blank" name="checkorder_status">
    <strong class="db mb1x title"><?php echo L('orderquery');?></strong>
    <div class="col-md-6 mb2x">
      <label for="order-number"><?php echo L('ordersn');?>:</label>
      <input type="text" name="order_sn" id="order-number" class="db width-half" data-msg="<?php echo L('order_query_error');?>">
      <input type="hidden" name="act" value="act_order_query">
      <button type="submit" class="mt1x btn btn-middle"><?php echo L('Confirm_query');?></button>
    </div>
    <div class="col-md-6">
      <strong class="db mb1x text normal"><?php echo L('_order_promise_')?></strong>
      <p class="ml1x mb1x"><?php echo L('_order_describe_')?></p>
      <strong class="db mb1x text normal"><?php echo L('free_four_week_shipping');?></strong>
      <p class="ml1x"><?php echo L('free_global_shipping');?></p>
    </div>
  </form>
</div>
<script>
$(function () {
  var $orderNumber = $('#order-number');

  $('form[name=checkorder_status]').on('click', 'button[type=submit]', function () {
    var orderNumber = $orderNumber.val(),
        $errorMsg = $orderNumber.next('.js-error'),
        msg = $orderNumber.data('msg'),
        reg = {
          empty: /^\s*$/,
          valid: /^[\.A-Za-z0-9]+/
        },
        isValid = false;

    if (orderNumber.length < 10 || !reg.valid.test(orderNumber)) {
      $orderNumber.addClass('error');
      if ($errorMsg.length === 0) {
        $orderNumber.after('<p class="error js-error">' + msg + '</p>');
        $errorMsg = $orderNumber.next('.js-error');
      }
    } else {
      isValid = true;
    }

    return isValid;
  });

  $orderNumber.on('focus', function () {
    $(this).removeClass('error').next('.js-error').remove();
  });
});
</script>
<?php include THEMES_PATH.'public/footer2.phtml';?>
<?php include THEMES_PATH.'public/after_body.phtml';?>